package com.example.windowdemo.window.command;

import com.example.windowdemo.callback.WindowCommand;
import com.example.windowdemo.window.Window;

/**
 * @author: njb
 * @date: 2023/8/3 11:40
 * @desc:
 */
public class SetDataCommand<T> implements WindowCommand {
    private Window<T> window;
    private T data;

    public SetDataCommand(Window<T> window, T data) {
        this.window = window;
        this.data = data;
    }

    @Override
    public void execute() {
        window.setData(data);
    }

    @Override
    public void cancel() {
        window.setData(null);
    }
}
